package cn.cdutetc.library.entity.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 图书状态枚举
 */
@Getter
@AllArgsConstructor
public enum BookStatusEnum {
    IN_STOCK("in_stock", "在库"),
    BORROWED("borrowed", "已借出"),
    ABNORMAL("abnormal", "异常");
    
    private final String code;
    private final String desc;
    
    public static BookStatusEnum getByCode(String code) {
        for (BookStatusEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }
}